package com.tools.cleanmaster.ui.card.viewholder;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;

import com.google.android.gms.ads.AdView;
import com.tools.ad.EntranceType;
import com.tools.ad.ui.crad.view.AmBannerCardView;
import com.tools.cleanmaster.CleanApplication;
import com.tools.cleanmaster.R;
import com.tools.cleanmaster.ui.card.ACardItem;

/**
 * 带有Loading的广告
 * Created by wen.yu.gang on 2018/7/5
 */
public class LoadingAdCardViewHolder extends ACardViewHolder {

    public FrameLayout mAdLayout;
    public View mAdvertView;
    public EntranceType mEntrance;

    @Override
    public View initView(Activity activity, ACardItem card, final int pos, EntranceType entrance) {
        CleanApplication cleanApplication = CleanApplication.getInstance();
        LayoutInflater layoutInflater = LayoutInflater.from(cleanApplication);

        mEntrance = entrance;

        mItemView = layoutInflater.inflate(R.layout.card_loading_ad, null);
        mAdLayout = mItemView.findViewById(R.id.ad_layout);

        View cardView = mEntrance.getAdScene().getAdView();
        if (cardView == null) {
            cleanApplication.getADModule().getAdSceneManager().load(entrance);
        }

        return mItemView;
    }
}
